<template>
  <div class="ee">
    <a-form :form="form">
      <a-form-item
        label="补货时间"
        :label-col="{ span: 3}"
        :wrapper-col="{ span: 16, offset:1}"
      >{{ this.$store.state.replenishmentTime }}</a-form-item>

      <a-form-item
        label="巡柜员"
        :label-col="{ span: 3}"
        :wrapper-col="{ span: 16, offset:1}"
      >{{ this.$store.state.employeeName }}</a-form-item>
      <a-form-item label="回库状态" :label-col="{ span: 3}" :wrapper-col="{ span: 12, offset:1}">
        <a-select v-decorator="['cruise',]" placeholder="请选择">
          <a-select-option value="0">待回库</a-select-option>
          <a-select-option value="1">已回库</a-select-option>
        </a-select>
      </a-form-item>
      <a-form-item label="待补货设备" :label-col="{ span: 3}">{{ this.$store.state.devCode }}</a-form-item>
      <a-form-item label="待补货设备地址" :label-col="{ span: 3}">{{ this.$store.state.posAddr}}</a-form-item>
      <a-form-item label="回库单商品详情" :label-col="{ span: 3 }" :wrapper-col="{}">
        <a-table class="tb" :columns="columns" :dataSource="data" :bordered="true">
          <template slot="name" slot-scope="text" href="javascript:;">{{text}}</template>
        </a-table>
      </a-form-item>
    </a-form>

    <a-form>
      <a-form-item label="备注" :label-col="{ span: 2}" :wrapper-col="{span: 22}">
        <a-textarea :autosize="{ minRows: 2, maxRows: 10 }" v-model="value"/>
      </a-form-item>
    </a-form>
    <div style="text-align:right">
      <router-link to="/home/repertoryadmin/backinvoice">
        <a-button type="dashed">取消</a-button>
      </router-link>
      <a-button type="primary" @click="enter()">确定</a-button>
    </div>
  </div>
</template>

<script>
const columns = [
  {
    //dataindex是用来渲染数据的
    dataIndex: "name",
    title: "商品名称",
    align: "center"

    // scopedSlots: { customRender: "name" }
  },
  {
    dataIndex: "replenishmentTime",
    title: "数量",

    align: "center"
  }
];
const data = [
  {
    key: "1"
  }
];
export default {
  data() {
    return {
      expand: false,
      form: this.$form.createForm(this),
      //      pagination: {
      //   //是否可以改变pagesize
      //   showSizeChanger: true,
      //   //是否可以快速条状某页数
      //   showQuickJumper: true,
      //   //每一页可以显示多好条数
      //   pageSizeOptions: ["2", "4", "8", "10", "12"],
      //   //用于显示数据总量和当前数据的顺序
      //   showTotal: (total, range) => {
      //     return `${range[0]}-${range[1]} 共${total}条`;
      //   },
      //   pageSize: 5,
      //   defaultCurrent: 1,
      //   current: 1,
      //   total: 500
      // },
      data: [],
      columns,
      value: ""
    };
  },
  methods: {
    //回货单编辑
    enter() {
      var values = this.form.getFieldsValue();
      console.log(values);
      console.log(this.value);
      this.axios
        .post(this.baseUrl + "/inboundOrder/edit", {
          loginToken: this.$store.state.loginToken,
          inboundOrderId: this.$store.state.inboundOrderId,
          remark: this.$store.state.remark
        })
        .then(response => {
          console.log(response);
          if (response.data.code == 0) {
            this.$router.push({
              path: "/home/repertoryadmin/backinvoice"
            });
            this.$message.info("编辑成功");
          }
        });
    }

    //  handleTablePop(pagination, filters, sorter) {
    //     const pager = { ...this.pagination };
    //     pager.current = pagination.current;
    //     pager.pageSize = pagination.pageSize;
    //     pager.total = pagination.total;
    //     this.pagination = pager;
    //     //必须要查询
    //     this.search();
    //   },
    // 回货单编辑
    // edit() {
    //   var values = this.form.getFieldsValue();
    //   this.axios
    //     .post(this.baseUrl + "/inboundOrder/edit", {
    //       loginToken: this.$store.state.loginToken,
    //       inboundOrderId: this.$store.state.inboundOrderId,
    //       remark: this.$store.state.remark,
    //       status: this.$store.status
    //     })
    //     .then(response => {
    //       console.log(response.data.data);
    //     });
    // }
  }
  // created() {
  //   this.edit();
  //   // this.backdetail();
  // }
};
</script>

<style>
.ee {
  width: 100%;
}
.tb {
  margin-left: 130px;
  /* margin-top: -10px; */
}
</style>
